package com.fzhucc.modules.displayMap.repository;

import com.fzhucc.modules.displayMap.domain.DisplayMap;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * @author yyg
 * @website https://eladmin.vip
 * @date 2022-10-25
 **/
public interface DisplayMapRepository extends JpaRepository<DisplayMap, Integer>, JpaSpecificationExecutor<DisplayMap> {
    @Query("SELECT a.type from DisplayMap as a where a.orgArea=:orgArea group by a.type")
    List<String> findByAllType(String orgArea);

    @Query("SELECT COUNT (a) from DisplayMap as a where a.type=:type and a.isShow=1 and a.orgArea=:orgArea")
    int findCountByAllType(String type, String orgArea);
}